package com.syt.test

import java.lang.IllegalArgumentException

/**
 * @author  YuTian
 * @date  2020/6/10 2:59 下午
 * @功能
 */
fun main() {

    val redmi = PhoneBase(111, "k30", null, null, null, null)

    println("redmi = ${redmi}")

    val s = redmi.toString() ?: throw IllegalArgumentException("name required")
    println("s = ${s}")

    loop@ for (i in 1..10) {
        for (j in 1..100 step 2) {
            if (51 == j) {
                break@loop
            }
            print("j = ${j}\t")
            println("i = ${i}")
        }
    }
    println("foo() = ${foo()}")
    println("Thread.currentThread().name = ${Thread.currentThread().name}")

    val test = Test(123, "hello")
    println("test = ${test}")

    println(EnumTest.JAVA)
}

fun foo() {
    listOf(1, 2, 3, 4, 5).forEach(
        fun(it: Int) {
            if (it == 4) return@forEach
            print(it)
        }
    )
    println(" this point is unreachable")
}